package com.czxy.config;


import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
@ComponentScan({"com.czxy.controller"})
@EnableWebMvc
public class SpringMVCConfig extends WebMvcConfigurerAdapter {





    //multipartResolver 方法名字必须是这个
    @Bean
    public CommonsMultipartResolver multipartResolver(){
        CommonsMultipartResolver resolver = new CommonsMultipartResolver();
        resolver.setMaxInMemorySize(10*1024*1024);
        resolver.setMaxUploadSize(4*1024*1024);
        resolver.setDefaultEncoding("UTF-8");
        return resolver;
    }


}
